package com.vanky.graph.controller;

import com.vanky.graph.pojo.Result;
import com.vanky.graph.pojo.fqResult;
import com.vanky.graph.service.AccurateQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("/accurate")
public class AccurateQueryController {

    @Autowired
    private AccurateQueryService accurateQueryService;

    //精确查询所有节点及两层节点
    @GetMapping("/query/all/{word}")
    public Result<List<fqResult>> queryAll(@PathVariable String word) {
        List<fqResult> result = accurateQueryService.queryAll(word);
        return Result.success(result);
    }

    //精确查询法院节点及两层节点
    @GetMapping("query/court/{word}")
    public Result<List<fqResult>> queryCourt(@PathVariable String word) {
        List<fqResult> result = accurateQueryService.queryCourt(word);
        return Result.success(result);
    }

    //精确查询法官节点及两层节点
    @GetMapping("query/judge/{word}")
    public Result<List<fqResult>> queryJudge(@PathVariable String word) {
        List<fqResult> result = accurateQueryService.queryJudge(word);
        return Result.success(result);
    }

    //精确查询当事人节点及两层节点
    @GetMapping("query/litigant/{word}")
    public Result<List<fqResult>> queryParty(@PathVariable String word) {
        List<fqResult> result = accurateQueryService.queryLitigant(word);
        return Result.success(result);
    }

    //精确查询案件节点及两层节点
    @GetMapping("query/case/{word}")
    public Result<List<fqResult>> queryCase(@PathVariable String word) {
        List<fqResult> result = accurateQueryService.queryCase(word);
        return Result.success(result);
    }

    //精确查询律师节点及两层节点
    @GetMapping("query/lawyer/{word}")
    public Result<List<fqResult>> queryLawyer(@PathVariable String word) {
        List<fqResult> result = accurateQueryService.queryLawyer(word);
        return Result.success(result);
    }

    //精确查询案由节点及两层节点
    @GetMapping("query/cause/{word}")
    public Result<List<fqResult>> queryCauseType(@PathVariable String word) {
        List<fqResult> result = accurateQueryService.queryCauseType(word);
        return Result.success(result);
    }

    //精确查询法条节点及两层节点
    @GetMapping("query/law/{word}")
    public Result<List<fqResult>> queryLaw(@PathVariable String word) {
        List<fqResult> result = accurateQueryService.queryLaw(word);
        return Result.success(result);
    }

    //精确查询律所节点及两层节点
    @GetMapping("query/lawfirm/{word}")
    public Result<List<fqResult>> queryLawFirm(@PathVariable String word) {
        List<fqResult> result = accurateQueryService.queryLawFirm(word);
        return Result.success(result);
    }
}
